<thead>
  <tr>
    <%
    active_scaffold_config_for(@record.class).subform.columns.each :for => @record, :flatten => true do |column|
      next unless in_subform?(column, parent_record) and column_renders_as(column) != :hidden
      -%>
      <th><%= column.label %></th>
    <% end -%>
  </tr>
</thead>